\(\int \tan ^3(e+f x) (a+b \tan ^2(e+f x)) \, dx\) [186]

   Optimal result
   Rubi [A] (verified)
   Mathematica [A] (verified)
   Maple [A] (verified)
   Fricas [A] (verification not implemented)
   Sympy [B] (verification not implemented)
   Maxima [A] (verification not implemented)
   Giac [B] (verification not implemented)
   Mupad [B] (verification not implemented)

Optimal result

Integrand size = 21, antiderivative size = 53 \[ \int \tan ^3(e+f x) \left (a+b \tan ^2(e+f x)\right ) \, dx=\frac {(a-b) \log (\cos (e+f x))}{f}+\frac {(a-b) \tan ^2(e+f x)}{2 f}+\frac {b \tan ^4(e+f x)}{4 f} \]

[Out]

(a-b)*ln(cos(f*x+e))/f+1/2*(a-b)*tan(f*x+e)^2/f+1/4*b*tan(f*x+e)^4/f

Rubi [A] (verified)

Time = 0.05 (sec) , antiderivative size = 53, normalized size of antiderivative = 1.00, number of steps used = 3, number of rules used = 3, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.143, Rules used = {3712, 3554, 3556} \[ \int \tan ^3(e+f x) \left (a+b \tan ^2(e+f x)\right ) \, dx=\frac {(a-b) \tan ^2(e+f x)}{2 f}+\frac {(a-b) \log (\cos (e+f x))}{f}+\frac {b \tan ^4(e+f x)}{4 f} \]

[In]

Int[Tan[e + f*x]^3*(a + b*Tan[e + f*x]^2),x]

[Out]

((a - b)*Log[Cos[e + f*x]])/f + ((a - b)*Tan[e + f*x]^2)/(2*f) + (b*Tan[e + f*x]^4)/(4*f)

Rule 3554

Int[((b_.)*tan[(c_.) + (d_.)*(x_)])^(n_), x_Symbol] :> Simp[b*((b*Tan[c + d*x])^(n - 1)/(d*(n - 1))), x] - Dis
t[b^2, Int[(b*Tan[c + d*x])^(n - 2), x], x] /; FreeQ[{b, c, d}, x] && GtQ[n, 1]

Rule 3556

Int[tan[(c_.) + (d_.)*(x_)], x_Symbol] :> Simp[-Log[RemoveContent[Cos[c + d*x], x]]/d, x] /; FreeQ[{c, d}, x]

Rule 3712

Int[((a_.) + (b_.)*tan[(e_.) + (f_.)*(x_)])^(m_.)*((A_.) + (C_.)*tan[(e_.) + (f_.)*(x_)]^2), x_Symbol] :> Simp
[C*((a + b*Tan[e + f*x])^(m + 1)/(b*f*(m + 1))), x] + Dist[A - C, Int[(a + b*Tan[e + f*x])^m, x], x] /; FreeQ[
{a, b, e, f, A, C, m}, x] && NeQ[A*b^2 + a^2*C, 0] &&  !LeQ[m, -1]

Rubi steps \begin{align*} \text {integral}& = \frac {b \tan ^4(e+f x)}{4 f}+(a-b) \int \tan ^3(e+f x) \, dx \\ & = \frac {(a-b) \tan ^2(e+f x)}{2 f}+\frac {b \tan ^4(e+f x)}{4 f}+(-a+b) \int \tan (e+f x) \, dx \\ & = \frac {(a-b) \log (\cos (e+f x))}{f}+\frac {(a-b) \tan ^2(e+f x)}{2 f}+\frac {b \tan ^4(e+f x)}{4 f} \\ \end{align*}

Mathematica [A] (verified)

Time = 0.19 (sec) , antiderivative size = 65, normalized size of antiderivative = 1.23 \[ \int \tan ^3(e+f x) \left (a+b \tan ^2(e+f x)\right ) \, dx=\frac {a \left (2 \log (\cos (e+f x))+\tan ^2(e+f x)\right )}{2 f}-\frac {b \left (4 \log (\cos (e+f x))+2 \tan ^2(e+f x)-\tan ^4(e+f x)\right )}{4 f} \]

[In]

Integrate[Tan[e + f*x]^3*(a + b*Tan[e + f*x]^2),x]

[Out]

(a*(2*Log[Cos[e + f*x]] + Tan[e + f*x]^2))/(2*f) - (b*(4*Log[Cos[e + f*x]] + 2*Tan[e + f*x]^2 - Tan[e + f*x]^4
))/(4*f)

Maple [A] (verified)

Time = 0.07 (sec) , antiderivative size = 55, normalized size of antiderivative = 1.04

method result size
norman \(\frac {b \tan \left (f x +e \right )^{4}}{4 f}+\frac {\left (a -b \right ) \tan \left (f x +e \right )^{2}}{2 f}-\frac {\left (a -b \right ) \ln \left (1+\tan \left (f x +e \right )^{2}\right )}{2 f}\) \(55\)
derivativedivides \(\frac {\frac {b \tan \left (f x +e \right )^{4}}{4}+\frac {a \tan \left (f x +e \right )^{2}}{2}-\frac {b \tan \left (f x +e \right )^{2}}{2}+\frac {\left (-a +b \right ) \ln \left (1+\tan \left (f x +e \right )^{2}\right )}{2}}{f}\) \(57\)
default \(\frac {\frac {b \tan \left (f x +e \right )^{4}}{4}+\frac {a \tan \left (f x +e \right )^{2}}{2}-\frac {b \tan \left (f x +e \right )^{2}}{2}+\frac {\left (-a +b \right ) \ln \left (1+\tan \left (f x +e \right )^{2}\right )}{2}}{f}\) \(57\)
parallelrisch \(-\frac {-b \tan \left (f x +e \right )^{4}-2 a \tan \left (f x +e \right )^{2}+2 b \tan \left (f x +e \right )^{2}+2 \ln \left (1+\tan \left (f x +e \right )^{2}\right ) a -2 \ln \left (1+\tan \left (f x +e \right )^{2}\right ) b}{4 f}\) \(68\)
parts \(\frac {a \left (\frac {\tan \left (f x +e \right )^{2}}{2}-\frac {\ln \left (1+\tan \left (f x +e \right )^{2}\right )}{2}\right )}{f}+\frac {b \left (\frac {\tan \left (f x +e \right )^{4}}{4}-\frac {\tan \left (f x +e \right )^{2}}{2}+\frac {\ln \left (1+\tan \left (f x +e \right )^{2}\right )}{2}\right )}{f}\) \(70\)
risch \(-i x a +i x b -\frac {2 i a e}{f}+\frac {2 i b e}{f}+\frac {2 a \,{\mathrm e}^{6 i \left (f x +e \right )}-4 b \,{\mathrm e}^{6 i \left (f x +e \right )}+4 a \,{\mathrm e}^{4 i \left (f x +e \right )}-4 b \,{\mathrm e}^{4 i \left (f x +e \right )}+2 a \,{\mathrm e}^{2 i \left (f x +e \right )}-4 b \,{\mathrm e}^{2 i \left (f x +e \right )}}{f \left ({\mathrm e}^{2 i \left (f x +e \right )}+1\right )^{4}}+\frac {\ln \left ({\mathrm e}^{2 i \left (f x +e \right )}+1\right ) a}{f}-\frac {\ln \left ({\mathrm e}^{2 i \left (f x +e \right )}+1\right ) b}{f}\) \(152\)

[In]

int(tan(f*x+e)^3*(a+b*tan(f*x+e)^2),x,method=_RETURNVERBOSE)

[Out]

1/4*b*tan(f*x+e)^4/f+1/2*(a-b)*tan(f*x+e)^2/f-1/2*(a-b)/f*ln(1+tan(f*x+e)^2)

Fricas [A] (verification not implemented)

none

Time = 0.26 (sec) , antiderivative size = 51, normalized size of antiderivative = 0.96 \[ \int \tan ^3(e+f x) \left (a+b \tan ^2(e+f x)\right ) \, dx=\frac {b \tan \left (f x + e\right )^{4} + 2 \, {\left (a - b\right )} \tan \left (f x + e\right )^{2} + 2 \, {\left (a - b\right )} \log \left (\frac {1}{\tan \left (f x + e\right )^{2} + 1}\right )}{4 \, f} \]

[In]

integrate(tan(f*x+e)^3*(a+b*tan(f*x+e)^2),x, algorithm="fricas")

[Out]

1/4*(b*tan(f*x + e)^4 + 2*(a - b)*tan(f*x + e)^2 + 2*(a - b)*log(1/(tan(f*x + e)^2 + 1)))/f

Sympy [B] (verification not implemented)

Leaf count of result is larger than twice the leaf count of optimal. 88 vs. \(2 (42) = 84\).

Time = 0.12 (sec) , antiderivative size = 88, normalized size of antiderivative = 1.66 \[ \int \tan ^3(e+f x) \left (a+b \tan ^2(e+f x)\right ) \, dx=\begin {cases} - \frac {a \log {\left (\tan ^{2}{\left (e + f x \right )} + 1 \right )}}{2 f} + \frac {a \tan ^{2}{\left (e + f x \right )}}{2 f} + \frac {b \log {\left (\tan ^{2}{\left (e + f x \right )} + 1 \right )}}{2 f} + \frac {b \tan ^{4}{\left (e + f x \right )}}{4 f} - \frac {b \tan ^{2}{\left (e + f x \right )}}{2 f} & \text {for}\: f \neq 0 \\x \left (a + b \tan ^{2}{\left (e \right )}\right ) \tan ^{3}{\left (e \right )} & \text {otherwise} \end {cases} \]

[In]

integrate(tan(f*x+e)**3*(a+b*tan(f*x+e)**2),x)

[Out]

Piecewise((-a*log(tan(e + f*x)**2 + 1)/(2*f) + a*tan(e + f*x)**2/(2*f) + b*log(tan(e + f*x)**2 + 1)/(2*f) + b*
tan(e + f*x)**4/(4*f) - b*tan(e + f*x)**2/(2*f), Ne(f, 0)), (x*(a + b*tan(e)**2)*tan(e)**3, True))

Maxima [A] (verification not implemented)

none

Time = 0.22 (sec) , antiderivative size = 70, normalized size of antiderivative = 1.32 \[ \int \tan ^3(e+f x) \left (a+b \tan ^2(e+f x)\right ) \, dx=\frac {2 \, {\left (a - b\right )} \log \left (\sin \left (f x + e\right )^{2} - 1\right ) - \frac {2 \, {\left (a - 2 \, b\right )} \sin \left (f x + e\right )^{2} - 2 \, a + 3 \, b}{\sin \left (f x + e\right )^{4} - 2 \, \sin \left (f x + e\right )^{2} + 1}}{4 \, f} \]

[In]

integrate(tan(f*x+e)^3*(a+b*tan(f*x+e)^2),x, algorithm="maxima")

[Out]

1/4*(2*(a - b)*log(sin(f*x + e)^2 - 1) - (2*(a - 2*b)*sin(f*x + e)^2 - 2*a + 3*b)/(sin(f*x + e)^4 - 2*sin(f*x
+ e)^2 + 1))/f

Giac [B] (verification not implemented)

Leaf count of result is larger than twice the leaf count of optimal. 890 vs. \(2 (49) = 98\).

Time = 1.38 (sec) , antiderivative size = 890, normalized size of antiderivative = 16.79 \[ \int \tan ^3(e+f x) \left (a+b \tan ^2(e+f x)\right ) \, dx=\text {Too large to display} \]

[In]

integrate(tan(f*x+e)^3*(a+b*tan(f*x+e)^2),x, algorithm="giac")

[Out]

1/4*(2*a*log(4*(tan(f*x)^2*tan(e)^2 - 2*tan(f*x)*tan(e) + 1)/(tan(f*x)^2*tan(e)^2 + tan(f*x)^2 + tan(e)^2 + 1)
)*tan(f*x)^4*tan(e)^4 - 2*b*log(4*(tan(f*x)^2*tan(e)^2 - 2*tan(f*x)*tan(e) + 1)/(tan(f*x)^2*tan(e)^2 + tan(f*x
)^2 + tan(e)^2 + 1))*tan(f*x)^4*tan(e)^4 + 2*a*tan(f*x)^4*tan(e)^4 - 3*b*tan(f*x)^4*tan(e)^4 - 8*a*log(4*(tan(
f*x)^2*tan(e)^2 - 2*tan(f*x)*tan(e) + 1)/(tan(f*x)^2*tan(e)^2 + tan(f*x)^2 + tan(e)^2 + 1))*tan(f*x)^3*tan(e)^
3 + 8*b*log(4*(tan(f*x)^2*tan(e)^2 - 2*tan(f*x)*tan(e) + 1)/(tan(f*x)^2*tan(e)^2 + tan(f*x)^2 + tan(e)^2 + 1))
*tan(f*x)^3*tan(e)^3 + 2*a*tan(f*x)^4*tan(e)^2 - 2*b*tan(f*x)^4*tan(e)^2 - 4*a*tan(f*x)^3*tan(e)^3 + 8*b*tan(f
*x)^3*tan(e)^3 + 2*a*tan(f*x)^2*tan(e)^4 - 2*b*tan(f*x)^2*tan(e)^4 + 12*a*log(4*(tan(f*x)^2*tan(e)^2 - 2*tan(f
*x)*tan(e) + 1)/(tan(f*x)^2*tan(e)^2 + tan(f*x)^2 + tan(e)^2 + 1))*tan(f*x)^2*tan(e)^2 - 12*b*log(4*(tan(f*x)^
2*tan(e)^2 - 2*tan(f*x)*tan(e) + 1)/(tan(f*x)^2*tan(e)^2 + tan(f*x)^2 + tan(e)^2 + 1))*tan(f*x)^2*tan(e)^2 + b
*tan(f*x)^4 - 4*a*tan(f*x)^3*tan(e) + 8*b*tan(f*x)^3*tan(e) + 4*a*tan(f*x)^2*tan(e)^2 - 4*b*tan(f*x)^2*tan(e)^
2 - 4*a*tan(f*x)*tan(e)^3 + 8*b*tan(f*x)*tan(e)^3 + b*tan(e)^4 - 8*a*log(4*(tan(f*x)^2*tan(e)^2 - 2*tan(f*x)*t
an(e) + 1)/(tan(f*x)^2*tan(e)^2 + tan(f*x)^2 + tan(e)^2 + 1))*tan(f*x)*tan(e) + 8*b*log(4*(tan(f*x)^2*tan(e)^2
 - 2*tan(f*x)*tan(e) + 1)/(tan(f*x)^2*tan(e)^2 + tan(f*x)^2 + tan(e)^2 + 1))*tan(f*x)*tan(e) + 2*a*tan(f*x)^2
- 2*b*tan(f*x)^2 - 4*a*tan(f*x)*tan(e) + 8*b*tan(f*x)*tan(e) + 2*a*tan(e)^2 - 2*b*tan(e)^2 + 2*a*log(4*(tan(f*
x)^2*tan(e)^2 - 2*tan(f*x)*tan(e) + 1)/(tan(f*x)^2*tan(e)^2 + tan(f*x)^2 + tan(e)^2 + 1)) - 2*b*log(4*(tan(f*x
)^2*tan(e)^2 - 2*tan(f*x)*tan(e) + 1)/(tan(f*x)^2*tan(e)^2 + tan(f*x)^2 + tan(e)^2 + 1)) + 2*a - 3*b)/(f*tan(f
*x)^4*tan(e)^4 - 4*f*tan(f*x)^3*tan(e)^3 + 6*f*tan(f*x)^2*tan(e)^2 - 4*f*tan(f*x)*tan(e) + f)

Mupad [B] (verification not implemented)

Time = 11.75 (sec) , antiderivative size = 57, normalized size of antiderivative = 1.08 \[ \int \tan ^3(e+f x) \left (a+b \tan ^2(e+f x)\right ) \, dx=\frac {b\,{\mathrm {tan}\left (e+f\,x\right )}^4}{4\,f}-\frac {\ln \left ({\mathrm {tan}\left (e+f\,x\right )}^2+1\right )\,\left (\frac {a}{2}-\frac {b}{2}\right )}{f}+\frac {{\mathrm {tan}\left (e+f\,x\right )}^2\,\left (\frac {a}{2}-\frac {b}{2}\right )}{f} \]

[In]

int(tan(e + f*x)^3*(a + b*tan(e + f*x)^2),x)

[Out]

(b*tan(e + f*x)^4)/(4*f) - (log(tan(e + f*x)^2 + 1)*(a/2 - b/2))/f + (tan(e + f*x)^2*(a/2 - b/2))/f